<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <ui:composition template="structpage/templates/defaultLayout.xhtml">
            <ui:define name="title">
                    <h:outputText value="ChequeTeatinos" />
        </ui:define>
        <ui:define name="content">
           <h:panelGroup layout="block" rendered="#{loginBean.logged == 1}"> 
                <h2>#{msg.info}</h2>
                <h:panelGroup layout="block" id="formulario">
                    <h:form>
                        <h:panelGroup layout="block" styleClass="form_settings">
                            <p>
                                <h:panelGroup>#{msg.email}</h:panelGroup><br/>
                                <p:outputLabel id="E-mail" value="#{loginBean.email}" styleClass="negrita"/> <br/>
                            </p>
                            <p>
                                <h:panelGroup>#{msg.name}</h:panelGroup><br/>
                                <p:inputText id="Nombre" label="Nombre" value="#{loginBean.nombre}" required="true" validatorMessage="Campo requerido">
                                    <f:ajax event="blur" render="NombreValidation" />  
                                </p:inputText>
                            </p>
                            
                            <p>
                                <h:panelGroup>#{msg.surname}</h:panelGroup><br/>
                                <p:inputText id="Apellidos" label="Apellidos" value="#{loginBean.apellidos}"/>
                            </p>
                            
                            <p>
                                <h:panelGroup>#{msg.tlf}</h:panelGroup><br/>
                                <p:inputText id="Telefono" label="Telefono" value="#{loginBean.numero}" required="true" validatorMessage="Campo requerido">
                                    <f:ajax event="blur" render="TelefonoValidation" />  
                                </p:inputText>
                            </p>
                            <h:commandButton value="#{msg.edit}" action="#{loginBean.modify()}" styleClass="submit"/>
                        </h:panelGroup>
                        <p>
                        <span><p:outputLabel value="#{loginBean.error}" styleClass="error"/></span>
                    </p>
                    <p>
                        <span><h:message for="Nombre" styleClass="error" id="NombreValidation"/></span>
                    </p>
                    <p>
                        <span><h:message for="Telefono" styleClass="error" id="TelefonoValidation"/></span>
                    </p>
                    </h:form>
                    
                </h:panelGroup>
            </h:panelGroup>
            <h:panelGroup rendered="#{loginBean.logged == 0}">
                No puedes acceder aquí si no estás logueado
                
            </h:panelGroup>
        </ui:define>
    </ui:composition>
</html>